#!/usr/bin/env bash

docker cp {{ project }}_web_1:/etc/java-8-openjdk/security/java.security /tmp
if [[ "Linux" = $(uname) ]]; then
  sed -i "s/source=file:\/dev\/random/source=file:\/dev\/.\/urandom/g" /tmp/java.security
else
  sed -i "" "s/source=file:\/dev\/random/source=file:\/dev\/.\/urandom/g" /tmp/java.security
fi
docker cp /tmp/java.security {{ project }}_web_1:/etc/java-8-openjdk/security/java.security

docker cp {{ project }}_web_1:/usr/local/tomcat/conf/server.xml /tmp
if [[ "Linux" = $(uname) ]]; then
  sed -i "s/Connector port=\"8080\" protocol=/Connector port=\"8080\" relaxedQueryChars=\"[,]\" protocol=/g" /tmp/server.xml
else
  sed -i "" "s/Connector port=\"8080\" protocol=/Connector port=\"8080\" relaxedQueryChars=\"[,]\" protocol=/g" /tmp/server.xml
fi
docker cp /tmp/server.xml {{ project }}_web_1:/usr/local/tomcat/conf/server.xml

rm /tmp/{java.security,server.xml}
rm /tmp/todo.sh
